﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;

namespace DAO
{
    public class LoaiDiaDiemDao
    {
        public IEnumerable<LOAIDIADIEM> LoaiDiaDiem()
        {
            DoixeDataContext DX = new DoixeDataContext();
            return DX.LOAIDIADIEMs;
        }
        public int LayMaLoaiDiaDiem(string TenDiaDiem)
        {
            DoixeDataContext DX = new DoixeDataContext();
            IEnumerable<LOAIDIADIEM> lddDto;
            lddDto = from dd in DX.LOAIDIADIEMs where dd.TenLoaiDD == TenDiaDiem select dd;
            if (lddDto.Count() == 0)
            {
                return -1;
            }
            return lddDto.Single().MaLoaiDD;
        }
    }
}
